package com.ruoyi.labdata.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.labdata.domain.LabPlatformInfo;
import com.ruoyi.labdata.service.ILabPlatformInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 实验平台信息Controller
 * 
 * @author winner pan
 * @date 2022-04-26
 */
@RestController
@RequestMapping("/labdata/platform")
public class LabPlatformInfoController extends BaseController
{
    @Autowired
    private ILabPlatformInfoService labPlatformInfoService;

    /**
     * 查询实验平台信息列表
     */
    @PreAuthorize("@ss.hasPermi('labdata:platform:list')")
    @GetMapping("/list")
    public TableDataInfo list(LabPlatformInfo labPlatformInfo)
    {
        startPage();
        List<LabPlatformInfo> list = labPlatformInfoService.selectLabPlatformInfoList(labPlatformInfo);
        return getDataTable(list);
    }

    /**
     * 导出实验平台信息列表
     */
  /*  @PreAuthorize("@ss.hasPermi('labdata:platform:export')")
    @Log(title = "实验平台信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LabPlatformInfo labPlatformInfo)
    {
        List<LabPlatformInfo> list = labPlatformInfoService.selectLabPlatformInfoList(labPlatformInfo);
        ExcelUtil<LabPlatformInfo> util = new ExcelUtil<LabPlatformInfo>(LabPlatformInfo.class);
        return util.exportExcel(list, "platform");
    }*/

    /**
     * 获取实验平台信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('labdata:platform:query')")
    @GetMapping(value = "/{platformId}")
    public AjaxResult getInfo(@PathVariable("platformId") Long platformId)
    {
        return AjaxResult.success(labPlatformInfoService.selectLabPlatformInfoById(platformId));
    }

    /**
     * 新增实验平台信息
     */
    @PreAuthorize("@ss.hasPermi('labdata:platform:edit')")
    @Log(title = "实验平台信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LabPlatformInfo labPlatformInfo)
    {
        return toAjax(labPlatformInfoService.insertLabPlatformInfo(labPlatformInfo));
    }

    /**
     * 修改实验平台信息
     */
    @PreAuthorize("@ss.hasPermi('labdata:platform:edit')")
    @Log(title = "实验平台信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LabPlatformInfo labPlatformInfo)
    {
        return toAjax(labPlatformInfoService.updateLabPlatformInfo(labPlatformInfo));
    }

    /**
     * 删除实验平台信息
     */
   /* @PreAuthorize("@ss.hasPermi('labdata:platform:remove')")
    @Log(title = "实验平台信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{platformIds}")
    public AjaxResult remove(@PathVariable Long[] platformIds)
    {
        return toAjax(labPlatformInfoService.deleteLabPlatformInfoByIds(platformIds));
    }*/
}
